package java编程思想.第18章._10_nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class TransferTo {
	private static final int BSIZE = 10;

	public static void main(String[] args) throws IOException {
		FileChannel in = new FileInputStream("D://data.txt").getChannel(),
				out = new FileOutputStream("D://data3.txt").getChannel();
		ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
		// in.transferTo(0, in.size(), out);
		out.transferFrom(in, 0, in.size());
	}
}
